<template>
  <div class="icons">
    <div>{{ list }}</div>
    <div><el-button @click="handClick">按钮one</el-button>{{ number }}</div>
  </div>
</template>

<script>
export default {
  name: 'HomePear',
  // 父传子通过属性来传值
  props: {
    list: String,
    count: Number
  },
  data () {
    return {
      selections: [1, 2, 3, 4],
      number: this.count // 父传子可以赋给其他变量--vue中单项数据流，子组件不能直接更改父组件的值，拷贝一下----(类似于深拷贝)
    }
  },
  computed: {
  },
  mounted () {
    console.log(this.list)
  },
  methods: {
    handClick () {
      this.number++
      this.$emit('changeToWriteAdvice', this.number) // 子组件像事件触发一样向父组件传值
    }
  }
}
</script>
